# -*- coding: utf-8 -*-
# @时间      : 2025/4/14 上午10:52
# @作者      : hhh
from time import sleep
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

url = "https://deyunce:828123@mall.deyunce.com/pc/"
service = Service(executable_path='chromedriver.exe')
driver = webdriver.Chrome(service=service)
driver.get(url)
driver.maximize_window()
sleep(1)

driver.implicitly_wait(10)
wait = WebDriverWait(driver,10,0.5)

wait.until(EC.visibility_of_element_located((By.XPATH,"//a[text()='登录']")))
ele = driver.find_element(By.XPATH,"//a[text()='登录']")
wait.until(EC.element_to_be_clickable(ele))
ele.click()
sleep(2)

wait.until(EC.visibility_of_element_located((By.XPATH,"//div[contains(text(),'账号密码登录')]")))
ele2 = driver.find_element(By.XPATH,"//div[contains(text(),'账号密码登录')]")
wait.until(EC.element_to_be_clickable(ele2))
ele2.click()
sleep(2)


wait.until(EC.visibility_of_element_located((By.XPATH,'//input[@placeholder="请输入账号/手机号码"]')))
ele3 = driver.find_element(By.XPATH,'//input[@placeholder="请输入账号/手机号码"]')
wait.until(EC.visibility_of(ele3))
ele3.send_keys('15075670661')
sleep(2)

wait.until(EC.visibility_of_element_located((By.XPATH,'//input[@placeholder="请输入密码"]')))
ele4 = driver.find_element(By.XPATH,'//input[@placeholder="请输入密码"]')
wait.until(EC.visibility_of(ele4))
ele4.send_keys('15075670661')
sleep(2)

wait.until(EC.visibility_of_any_elements_located((By.XPATH,"//span[text()='立即登录']")))
ele5 = driver.find_elements(By.XPATH,"//span[text()='立即登录']")[1]
wait.until(EC.element_to_be_clickable(ele5))
ele5.click()
sleep(2)


wait.until(EC.visibility_of_element_located((By.XPATH,'//a[@href="/pc/user/profile"]')))
ele6 = driver.find_element(By.XPATH,'//a[@href="/pc/user/profile"]')
wait.until(EC.element_to_be_clickable(ele6))
ele6.click()
sleep(2)

wait.until(EC.visibility_of_element_located((By.XPATH,'//div[@class="lighter xs item"]')))
ele6 = driver.find_element(By.XPATH,'//div[@class="lighter xs item"]')
wait.until(EC.element_to_be_clickable(ele6))
ele6.click()
sleep(2)




driver.quit()